/*
  Copyright (C) 2015 Luca Donaggio
  Contact: Luca Donaggio <donaggio@gmail.com>
  All rights reserved.

  You may use this file under the terms of MIT license as follows:

  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files (the "Software"), to deal
  in the Software without restriction, including without limitation the rights
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  copies of the Software, and to permit persons to whom the Software is
  furnished to do so, subject to the following conditions:

  The above copyright notice and this permission notice shall be included in
  all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  THE SOFTWARE.
*/

import QtQuick 2.0
import Sailfish.Silica 1.0

Page {
    id: page

    readonly property string pageType: "about"

    allowedOrientations: Orientation.Portrait | Orientation.Landscape

    SilicaFlickable {
        id: aboutFlickable

        anchors.fill: parent
        contentHeight: header.height + aboutContainer.height

        PageHeader {
            id: header

            title: qsTr("About Fractal Sea")
        }

        Column {
            id: aboutContainer

            anchors.top: header.bottom
            width: parent.width
            spacing: Theme.paddingSmall

            Label {
                width: (parent.width - (2 * Theme.paddingLarge))
                x: Theme.paddingLarge
                horizontalAlignment: Text.AlignRight
                font.pixelSize: Theme.fontSizeSmall
                font.italic: true
                wrapMode: Text.WordWrap
                text: qsTr("Version %1\n(C) 2015 by Luca Donaggio").arg(Qt.application.version)
            }

            Label {
                width: (parent.width - (2 * Theme.paddingLarge))
                x: Theme.paddingLarge
                horizontalAlignment: Text.AlignJustify
                wrapMode: Text.WordWrap
                textFormat: Text.StyledText
                text: qsTr("<p>Sail on the fascinating waves of a fractal sea and explore the depths of some of the most famous fractal sets!</p>
    <p>All the math is done using your mobile device's GPU for better performance, leveraging emulated double precision arithmetic to reach even higher magnifications</p>")
            }

            SectionHeader {
                text: qsTr("Credits")
            }

            Label {
                width: (parent.width - (2 * Theme.paddingLarge))
                x: Theme.paddingLarge
                horizontalAlignment: Text.AlignJustify
                wrapMode: Text.WordWrap
                textFormat: Text.StyledText
                linkColor: Theme.highlightColor
                text: qsTr("<p>GLSL code is based on the work of Henry Thasler as detaild in this <a href=\"https://www.thasler.com/blog/blog/glsl-part2-emu\">blog post</a>.</p>
    <p>Mandelbrot set smooth-coloring algorithm can be found <a href=\"http://linas.org/art-gallery/escape/escape.html\">here</a>.</p>")

                onLinkActivated: Qt.openUrlExternally(link)
            }

            SectionHeader {
                text: qsTr("License")
            }

            Label {
                width: (parent.width - (2 * Theme.paddingLarge))
                x: Theme.paddingLarge
                horizontalAlignment: Text.AlignJustify
                wrapMode: Text.WordWrap
                textFormat: Text.StyledText
                linkColor: Theme.highlightColor
                text: qsTr("<p>This is an open source project released under the <a href=\"http://opensource.org/licenses/MIT\">MIT License</a>.</p>")

                onLinkActivated: Qt.openUrlExternally(link)
            }

            SectionHeader {
                text: qsTr("Sources")
            }

            Label {
                width: (parent.width - (2 * Theme.paddingLarge))
                x: Theme.paddingLarge
                horizontalAlignment: Text.AlignJustify
                wrapMode: Text.WordWrap
                textFormat: Text.StyledText
                linkColor: Theme.highlightColor
                text: qsTr("<p>Source code is available <a href=\"https://code.google.com/p/harbour-fractalsea/source/\">here</a>.</p>
    <p>Issues or feature requests can be reported <a href=\"https://code.google.com/p/harbour-fractalsea/issues/\">here</a>.</p>")

                onLinkActivated: Qt.openUrlExternally(link)
            }
        }

        VerticalScrollDecorator { flickable: aboutFlickable }
    }
}
